#ifndef SHELF_H
#define SHELF_H

#include <QObject>
#include <QMutex>
#include <QVector>

namespace library {

  class Shelf : public QObject {

    Q_OBJECT

   public:

    explicit Shelf(int max, QObject *parent = 0);

    void  take(int pos);
    void  put(int pos);
    void  put_new(int pos);
    int   try_write_new();
    int   size();

  signals:

    void newBook();
      
  private:

    int max;
    QVector<QMutex*> collection;

    QMutex *mutex;

  };

} // namespace library

#endif // SHELF_H
